﻿@{
    Layout = null;
}
@using Models;
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>电商预约系统</title>
    <link rel="shortcut icon" href="@Url.Content("~/Content/images/favicon/favicon.png")" type="image/x-icon" />
    <!--jQuery库-->
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
    <!--jQuery Easy库-->
    <link href="~/Content/css/base.css" rel="stylesheet" />
    <link id="easyuiTheme1" href="~/Content/EasyUI/themes/default/easyui.css" rel="stylesheet" />
    <link id="easyuiTheme2" href="~/Content/css/themes/default/main.css" rel="stylesheet" />
    <link href="~/Content/css/default.css" rel="stylesheet" />
    <link href="~/Content/css/icons/icon.css" rel="stylesheet" />
    <script src="~/Content/EasyUI/jquery.easyui.min.js"></script>
    <script src="~/Content/EasyUI/locale/easyui-lang-zh_CN.js"></script>
    <script src="~/Scripts/jquery.cookie.js"></script>
    <!--jquery-easyui-portal-->
    <link href="~/jquery-easyui-portal/portal.css" rel="stylesheet" />
    <script src="~/jquery-easyui-portal/jquery.portal.js"></script>
    <!--自定义库-->
    <script src="~/Scripts/Page/processingajaxmsg.js"></script>
    <script src="~/Scripts/Page/xzUtil.js"></script>
    <script src="~/Scripts/Page/layout-center.js"></script>
    <script src="~/Scripts/Page/layout-west.js"></script>
    <script type="text/javascript">
    /*从Cookie中读取保存的主题信息*/
    function initTheme() {
        var cookie_skin = $.cookie("themeName");
        if (cookie_skin) {
            var $easyuiTheme1 = $("#easyuiTheme1");
            var $easyuiTheme2 = $("#easyuiTheme2");
            var url1 = $easyuiTheme1.attr('href');
            var url2 = $easyuiTheme2.attr('href');
            var $southClass = $("#south");
            var $skinspan = $("#skinspan");
            $easyuiTheme1.attr('href', url1.substring(0, url1.indexOf('themes')) + 'themes/' + cookie_skin + '/easyui.css');
            $easyuiTheme2.attr('href', url2.substring(0, url2.indexOf('themes')) + 'themes/' + cookie_skin + '/main.css');
            $southClass.attr('class', 'head-south-' + cookie_skin);
            var spantitle = "默认";
            if (cookie_skin == "metro-green") { spantitle = "Metro-绿"; }
            else if (cookie_skin == "gray") { spantitle = "流行灰"; }
            else { spantitle = "默认"; }
            $skinspan.text(spantitle);
        }
    }
    $(document).ready(function () {
        initTheme();
        //loadGrid();
        //loadTreeGrid();
        //loadCalendar();
    });
    /*退出当前系统*/
    function myExit() {
        $.messager.confirm("请确认", "您确定要退出吗?", function (r) {
            if (r) {
                $.ajax({
                    type: 'POST',
                    url: '/Login/LoginOut',
                    success: dealWithLoginOut
                });
            }

        });

    }
    /*利用封装的方法把修改的密码的对话框显示出来*/
    function showMPwdView() {
        $.validateUrl("/Admin/Home/View_ModifyPwd", function () {
            var p = xz.dialog({
                title: '修改密码',
                width: 300,
                height: 200,
                href: '/Admin/Home/View_ModifyPwd',
                iconCls: 'icon-pwd',
                buttons: [{
                    iconCls: 'icon-ok',
                    text: '修改',
                    handler: function () {
                        var f = p.find('form');
                        f.form('submit', {
                            url: '/Admin/UO_Users/EditUserPwd',
                            success: function (jsonData) {
                                jsonData = $.parseJSON(jsonData);
                                $.procAjaxMsg(jsonData, function () {
                                    p.dialog('close');
                                    $.alertMsg(jsonData.Msg, '操作提示', function () {
                                        window.location.href = jsonData.BackUrl;
                                    });

                                }, function () {
                                    $.alertMsg(jsonData.Msg, '操作提示', null);
                                });
                            }
                        });

                    }
                }, {
                    iconCls: 'icon-cancel',
                    text: '取消',
                    handler: function () {
                        p.dialog('close');
                    }
                }],
                onLoad: function () {
                    var f = p.find('form');
                    f.form("load", {
                        uId: '@ViewBag.UId',
                        cLoginName: '@ViewBag.ULoginName'
                    });
                }

            });
        }, dealWith);
    }
    /*ajax提交成功以后调用的方法*/
    function dealWithLoginOut(jsonData) {
        $.procAjaxMsg(jsonData, function () {
            window.location.href = jsonData.BackUrl;
        }, function () {
            $.alertMsg(jsonData.Msg, '退出失败', null);
        })
    }

    /*ajax提交成功以后调用的方法只有提示*/
    function dealWith(jsonData) {
        $.alertMsg(jsonData.Msg, "操作提示", null);
    }

    /*加载角色信息*/
    function loadGrid() {
        datagrid = $('#rolegrid').datagrid({
            url: '/AdminCenter/UO_Role/GetRoleInfoByCondition',
            title: '',
            iconCls: 'icon-save',
            fit: true,
            fitColumns: true,
            nowrap: false,
            animate: false,
            border: false,
            pagination: true,
            pageSize: 5,
            pageList: [5, 10],
            idField: 'rId',
            frozenColumns: [[{
                title: '编号',
                field: 'rId',
                align: 'center',
                width: 50,
            }, {
                field: 'rName',
                title: '角色名',
                align: 'center',
                width: 100,
                editor: {
                    type: 'validatebox',
                    options: {
                        required: true
                    }
                },
                formatter: function (value) {
                    if (value) {
                        return xz.fs('<span title="{0}">{1}</span>', value, value);
                    }
                }
            }]],
            columns: [[
            {
                field: 'depName',
                title: '所属部门',
                align: 'center',
                width: 100
            },
            {
                field: 'rRemark',
                align: 'center',
                title: '说明',
                width: 100

            },

            {
                field: 'rAddTime',
                title: '操作日期',
                align: 'center',
                width: 80,
                formatter: function (value, rec) {
                    if (value) {
                        return eval("new " + value.substr(1, value.length - 2)).toLocaleDateString();
                    }
                }

            }]]
        });
    }

    /*加载权限信息*/
    function loadTreeGrid() {
        treegrid = $('#treegrid').treegrid({
            url: '/Admin/UO_Permission/GetAllPersForTreeGridPer',
            title: '',
            iconCls: 'icon-save',
            fit: true,
            fitColumns: true,
            nowrap: false,
            animate: false,
            border: false,
            idField: 'pid',
            treeField: 'pName',
            columns: [[
                {
                    title: 'pid',
                    field: 'pid',
                    width: 150,
                    hidden: true
                }, {
                    field: 'pName',
                    title: '权限名称',
                    width: 200,
                    rowspan: 2,
                    formatter: function (value) {
                        if (value) {
                            return xz.fs('<span title="{0}">{1}</span>', value, value);
                        }
                    }
                },
                 {
                     field: 'iconCls',
                     title: '图标',
                     width: 70,
                     rowspan: 2,
                     formatter: function (value) {
                         if (!value) {
                             return '';
                         } else {
                             return xz.fs('<span class="{0}" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span>', value);
                         }
                     }
                 }, {
                     field: '_parentId',
                     title: '上级权限ID',
                     width: 150,
                     rowspan: 2,
                     hidden: true
                 }, {
                     field: 'pRemark',
                     title: '权限说明',
                     rowspan: 2,
                     width: 150
                 }, {
                     field: 'pOperTime',
                     title: '操作日期',
                     rowspan: 2,
                     width: 150,
                     formatter: function (value, rec) {
                         return eval("new " + value.substr(1, value.length - 2)).toLocaleDateString();
                     }
                 }, {
                     field: 'pOrder',
                     title: '排序',
                     rowspan: 2,
                     width: 80
                 }]],
            onExpand: function (row) {
                treegrid.treegrid('unselectAll');
            },
            onCollapse: function (row) {
                treegrid.treegrid('unselectAll');
            }
        });
    }

    /*加载日历信息*/
    function loadCalendar() {
        $('#calendar').calendar({
            fit: true,
            current: new Date(),
            border: false,
            onSelect: function (date) {
                $(this).calendar('moveTo', new Date());
            }
        });
    }
    /*改变导航方式*/
    function changeNav(nav) {
        $.ajax({
            type: 'POST',
            url: '/AdminCenter/UO_UserSetting/EditUserSetting',
            data: {
                SettingCode: 'navigation',
                SettingValue: nav
            },
            dataType: 'json',
            success: function (jsonData) {
                $.procAjaxMsg(jsonData, function () {
                    $.alertMsg(jsonData.Msg, "成功修改", function () {
                        window.location.reload();
                    })
                }, function () {
                    $.alertMsg(jsonData.Msg, "修改失败", null)
                });
            }
        });
    }
    </script>
</head>
<body class="easyui-layout" data-options="fit:true" scroll="no" overflow：hidden>
    <noscript>
        <div class="noscript">
            <img src="~/Content/images/noscript.gif" alt="抱歉，请开启脚本支持！" />
        </div>
    </noscript>
    <div data-options="region:'north'" id="north" class="head-north">
        <div class="head head-right">
            <a href="javascript:void(0);" class="easyui-menubutton" data-options="menu:'#pfMenu',iconCls:'icon-color_swatch'">皮肤:<span id="skinspan">默认</span></a>
            <a href="javascript:void(0);" class="easyui-menubutton" data-options="menu:'#user',iconCls:'icon-user'" style="margin-left:10px; margin-right:10px;">
                用户:
                @if (ViewData["cUser"] != null)
                {
                    UO_User cUser = ViewData["cUser"] as UO_User;
                    @cUser.ULoginName
                }
            </a>
        </div>
        <span class="head-left">
            电商预约管理系统
        </span>
    </div>
    <div data-options="region:'south'" id="south" class="head-south-default" style="height:30px;margin-top:5px">
        <div class="footer">Copyright &copy; 2017,君和君泰版权所有 All Rights Reserved</div>
    </div>
    <div data-options="region:'west',split:true,title:'导航菜单'" id="west" style="width:200px;padding:0px;">
        <div id="wnav"></div>
    </div>
    <div id="center" data-options="region:'center'">
        <div id="tabs" class="easyui-tabs" data-options="border:false,fit:true">
            <div title="我的桌面" style="overflow: hidden" data-options="iconCls:'icon-home'">
                <div style="position:relative;" id="portal">
                    <div></div>
                </div>
            </div>
        </div>
        <div id="tabsMenu" style="width: 120px; display: none; background: #D2E0F2;">
            <div title="refresh" class="icon-reload">刷新</div>
            <div class="menu-sep"></div>
            <div title="close" class="icon-remove">关闭</div>
            <div class="menu-sep"></div>
            <div title="closeOther" class="icon-cut">关闭其他</div>
            <div class="menu-sep"></div>
            <div title="closeAll" class="icon-no">关闭所有</div>
        </div>
    </div>
    <!--换肤html-->
    <div id="pfMenu" style="width: 100px; display: none;">
        <div data-options="iconCls:'icon-color_default'" data-key="default">默认</div>
        <div class="menu-sep"></div>
        <div data-options="iconCls:'icon-color_gray'" data-key="gray">灰色</div>
        <div class="menu-sep"></div>
        <div data-options="iconCls:'icon-color_green'" data-key="metro-green">Metro-绿</div>
    </div>
    <div id="user" style="width:120px; display: none;">
        <div data-options="iconCls:'icon-edit'" onclick="showMPwdView();">修改密码</div>
        <div class="menu-sep"></div>
        <div data-options="iconCls:'icon-user_go'" onclick="myExit();">安全退出</div>
    </div>
</body>
</html>